home *** CD-ROM | disk | FTP | other *** search
- Path: lade.news.pipex.net!pipex!exnet2!anweald!ph
- From: ph@anweald.exnet.co.uk (Patrick Herring)
- Newsgroups: comp.lang.rexx
- Subject: Re: string to numeric
- Distribution: world
- Message-ID: <821288322snx@anweald.exnet.co.uk>
- References: <821110610.11snx@wims.ow.nl>
- Date: Wed, 10 Jan 96 15:38:42 GMT
- Organization: Anweald Systems
-
- wim@wims.ow.nl writes in article <821110610.11snx@wims.ow.nl>:
- >
- > In article <820350435snx@anweald.exnet.co.uk> ph@anweald.exnet.co.uk writes:
- > >
- > >dan@camelot.rockefeller.edu writes in article <DK> D30E.A9w@rockyd.rockefeller.ed>u>:
- > >>
- > >> Is there a function that can take a variable declared like
- > >>
- > >> data = 123
- > >>
- > >> and convert it so that the variable's value is actually 123
- > >> (that's the number 123, NOT a character string consisting
- > >> od ASCII 1 followed by ASCII 2 followed by ASCII 3... which
- > >> I think is 31, 32, 33)
- > >>
- > >> I need to pass these variables as integers to a device driver.
- > >>
- > >> In fact, REXX must have this built in, otherwise how could it
- > >> do addition with variables saved as strings?
- > >
- > >Rexx's arithmetic is defined and implemented as operations on strings, believe>
- > >it or not :-) . This gives a lot of portability at the expense of speed.
- > >
- > >I think what you mean is 123 as it would be physically in C ie in binary. The > >function d2x( 123 ) gives this (7B).
- >
- > This is the Hex value. You can get binary value with d2c(). If you look at
- > the output you see "{" .
-
- Hmm, yes, elementary mistake by me, oh dear. Still, as Dan said, it's a
- confusing part of Rexx in that the input to d2c() is a char string and you get
- back a binary number. One thing the thread did show up is that there is no one
- thing that is 'really' a number in Rexx. Coming from COBOL I'm not surprised.
-
- Yours, Patrick
- _____________________________________________________________________________
-
- Patrick Herring, Primrose Hill, London, UK
- I tend to eat my UUCP feed once a day so replies can take two days
-